package utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigManager {

    private static Properties properties;
//    private static ConfigManagerconfigManager = null;
//    private static ConfigManagerconfigManager = new ConfigManager();

    public String getValue(String key){
        return properties.getProperty(key);
    }

    public static synchronized ConfigManager getInstance(){
        Object configManager = null;
        if (configManager == null) {
            configManager = new ConfigManager();
        }
        return (ConfigManager) configManager;
    }

    private ConfigManager(){
        String configFile = "source.properties";
        properties = new Properties();
        InputStream is = ConfigManager.class.getClassLoader().getResourceAsStream(configFile);

        try {
            properties.load(is);
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

//    public static ConfigManagergetInstance(){
//        return configManager;
//    }


}
